class CreateDeadlines < ActiveRecord::Migration
  def self.up
    create_table :deadlines do |t|
      t.column  :title, :string, :null => false
      t.column  :description, :text
      t.column  :end, :date, :null => false
      t.column  :teaching_id, :integer, :null => false
    end
    add_index :deadlines, [:teaching_id, :title], :name => 'unique_title_for_teaching', :unique => true
  end

  def self.down
    drop_table :deadlines
  end
end
